package com.freewater.cargotracker.infrastructure.persistence.mybatis.mapper;

import com.freewater.cargotracker.infrastructure.persistence.mybatis.dbobject.CargoCustomerPO;
import com.freewater.cargotracker.infrastructure.persistence.mybatis.dbobject.CustomerPO;
import com.freewater.cargotracker.infrastructure.persistence.mybatis.dbobject.CustomerWithRolePO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

@Mapper
public interface CustomerMapper {

    int insert(CustomerPO customerPO);

    CustomerPO findByCustomerNo(@Param("customerNo") String customerNo);

    CustomerPO findByName(@Param("name") String name);

    @MapKey("role")
    Map<String, CustomerWithRolePO> findCustomersByCargoId(@Param("cargoId") Long cargoId);

    int deleteAll();
}
